package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ArticleLabelMapper;
import com.ruoyi.system.domain.ArticleLabel;
import com.ruoyi.system.service.IArticleLabelService;

/**
 * 查询关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-03-13
 */
@Service
public class ArticleLabelServiceImpl implements IArticleLabelService 
{
    @Autowired
    private ArticleLabelMapper articleLabelMapper;

    /**
     * 查询查询关联
     * 
     * @param id 查询关联主键
     * @return 查询关联
     */
    @Override
    public ArticleLabel selectArticleLabelById(Long id)
    {
        return articleLabelMapper.selectArticleLabelById(id);
    }

    /**
     * 查询查询关联列表
     * 
     * @param articleLabel 查询关联
     * @return 查询关联
     */
    @Override
    public List<ArticleLabel> selectArticleLabelList(ArticleLabel articleLabel)
    {
        return articleLabelMapper.selectArticleLabelList(articleLabel);
    }

    /**
     * 新增查询关联
     * 
     * @param articleLabel 查询关联
     * @return 结果
     */
    @Override
    public int insertArticleLabel(ArticleLabel articleLabel)
    {
        return articleLabelMapper.insertArticleLabel(articleLabel);
    }
    
    @Override
	public int batchInsert(List<ArticleLabel> articleLabel) 
    {
    	int a = articleLabelMapper.deleteArticleLabelByArticleId(articleLabel.get(0).getArticleId());
    	System.out.println(a);
    	return  articleLabelMapper.batchInsert(articleLabel);
	}
    
    /**
     * 修改查询关联
     * 
     * @param articleLabel 查询关联
     * @return 结果
     */
    @Override
    public int updateArticleLabel(ArticleLabel articleLabel)
    {
        return articleLabelMapper.updateArticleLabel(articleLabel);
    }

    /**
     * 批量删除查询关联
     * 
     * @param ids 需要删除的查询关联主键
     * @return 结果
     */
    @Override
    public int deleteArticleLabelByIds(Long[] ids)
    {
        return articleLabelMapper.deleteArticleLabelByIds(ids);
    }

    /**
     * 删除查询关联信息
     * 
     * @param id 查询关联主键
     * @return 结果
     */
    @Override
    public int deleteArticleLabelById(Long id)
    {
        return articleLabelMapper.deleteArticleLabelById(id);
    }

	@Override
	public int deleteArticleLabelByArticleId(Long articleId) {
		return articleLabelMapper.deleteArticleLabelByArticleId(articleId);
	}

	
}
